package Sequence;

public class Test0111 {
}

class Solution0111_1 {
    public int minDepth(TreeNode root) {
        if (root == null) return 0;
        int ans;
        if (root.left == null&&root.right==null) ans=0;
        else if (root.right==null) ans=minDepth(root.left);
        else if (root.left==null) ans=minDepth(root.right);
        else ans=Math.min(minDepth(root.left), minDepth(root.right));

        return ans+1;
    }
}
